package errorx

// 错误码常量
const (
	SuccessCode     = 200 // 成功
	FailedCode      = 500 // 失败
	AuthErrorCode   = 401 // 认证错误
	ServerErrorCode = 502 // 服务器错误
)

// 错误消息常量
const (
	SuccessMessage     = "success"
	FailedMessage      = "failed"
	ServerErrorMessage = "服务器错误"
)

// 通用错误
var (
	SuccessError = NewErrorX(SuccessCode, SuccessMessage)
	FailedError  = NewErrorX(FailedCode, FailedMessage)
	ServerError  = NewErrorX(ServerErrorCode, ServerErrorMessage)
)

// 认证错误
var (
	LoginError      = NewErrorX(AuthErrorCode, "用户名或密码错误")
	CaptchaError    = NewErrorX(AuthErrorCode, "验证码错误")
	SmsCaptchaError = NewErrorX(AuthErrorCode, "短信验证码错误")
	TokenInvalid    = NewErrorX(AuthErrorCode, "身份验证失败，请重新登录")
)

// 权限错误
var (
	NoPermissionError = NewErrorX(AuthErrorCode, "无权限")
)

// 自定义错误
var (
	TenantNotFoundError = NewErrorX(FailedCode, "租户不存在")
)
